﻿//日计划
var fnDatePlan = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    var dpid = "";
    var date = "";
    if (record != null) {
        dpid = record.getData(const_entityID);
        date = record.getData("WriteDate");
    }
    parent.addTabs(date + '日计划', '../TR/DatePlan.aspx?r=' + Math.random() + '&entity=TrDatePlan&Type=P&DPID=' + dpid);
    parent.NeedRefreshPage = this;
}
//日结果
var fnDateResult = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    var dpid = "";
    var date = "";
    if (record != null) {
        dpid = record.getData(const_entityID);
        date = record.getData("WriteDate");
    }
    else {
        alert("请选择一条记录");
        return;
    }
    parent.addTabs(date + '日结果', '../TR/DatePlan.aspx?r=' + Math.random() + '&entity=TrDatePlan&Type=R&DPID=' + dpid);
    parent.NeedRefreshPage = this;
}
var fnchakan= function (){
    CustomDbClick();
}
//双击事件
function CustomDbClick() {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    var dpid = "";
    var date = "";
    if (record != null) {
        dpid = record.getData(const_entityID);
        date = record.getData("WriteDate");
    }
    else {
        alert("请选择一条记录");
        return;
    }
    parent.$("#tabs").tabs('close', date + '日计划日结果');
    parent.addTabs(date + '日计划日结果', '../TR/DateLook.aspx?r=' + Math.random() + '&entity=TrDatePlan&DPID=' + dpid);
}
if (typeof ($) != "undefined") {
    $(document).ready(function () {
        try {
            var varStr = $("form").attr("action");
            var arr = varStr.split('&');
            var arr2 = new Array();
            for (var i = 1; i < arr.length; i++) {
                arr2.push(arr[i]);
            }
            var varCheck = arr2[0].substring(7, arr2[0].length);
            if (varCheck == "check") {
                $("#fieldForm").wrap("<span id='wrap'></span>");
                var obj = document.getElementById("wrap");
                obj.onmouseover = function () {
                    obj.setCapture();
                }
                obj.onmouseout = function () {
                    obj.releaseCapture();
                }
                obj.onfocus = function () {
                    obj.blur();
                }
                obj.onbeforeactivate = function () {
                    return false;
                }
            }
        } catch (Error) { }
    })
}


//点评
var fnCheck = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    document.getElementById("EditUIWindow").src = "../TR/WorkCheck.aspx?r=" + Math.random() + "&entity=TrWeekPlan&TYPE=D&WPID=" + record.getData(const_entityID);
    YAHOO.example.container.dialog1.show();
}